import Vue from 'vue'
const url = {
    // 获取url
    urlPath: function urlPath(ip, postdata) {
        return Vue.http.get(ip, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    },
    // 修改url
    urlUpdatePath: function urlUpdatePath(ip, postdata) {
        // console.log('修改url', postdata, ip)
        var ipStr = ip + "/" + postdata.url
        return Vue.http.post(ip, postdata).then(response => {
            if (response.status === 200) {
                return Promise.resolve(response.body)
            } else {
                return Promise.reject(response.data.message)
            }
        })
    }
}

export default url